import java.applet.Applet;
import java.awt.Graphics;
import java.awt.image.BufferedImage;

public class Game extends Applet implements Runnable{
	private static final long serialVersionUID = 1L;
	public static final int WIDTH = 800;
	public static final int HEIGHT = 600;

	BufferedImage screen = new BufferedImage(WIDTH, HEIGHT, 4);
	Graphics s = screen.getGraphics();

	int x = 0;
	int y = 100;
	
	public void init() {
		setSize(WIDTH, HEIGHT);
		Thread th = new Thread(this);
		th.start();
	}

	public void paint(Graphics g) {
		s.clearRect(0, 0, WIDTH, HEIGHT);
		s.drawString("Hello ", x, y);
		g.drawImage(screen, 0, 0, this);
	}

	public void update(Graphics g) {
		paint(g);
	}

	@Override
	public void run() {
		while(true) {
			x++;
			repaint();
			try{
				Thread.sleep(20);
			} catch(Exception e) {
				System.out.println("Insomnia");
			}
		}
	}
}
